package com.sensetime.bi.senselink.server.entity.rtp;

import com.sensetime.bi.senselink.server.util.StringUtils;
import io.netty.buffer.ByteBuf;

public class TcpHeader {
    public byte magic; // $ 字符
    public byte channel; // channel，用于区分RTP和RTCP
    public int rtpPkgLength; // RTP包的大小

    public void setHeader(ByteBuf buf) {
        magic = buf.readBytes(1).readByte();//.writeByte(magic);
        channel = buf.readBytes(1).readByte();//.writeByte(channel);
        rtpPkgLength = buf.readBytes(2).readShort();
    }

    public String print() {
        return "magic:" + StringUtils.byteToHex(magic) + ", channel:" + StringUtils.byteToHex(channel) + ", rtpPkgLength:" + rtpPkgLength;
    }
}
